﻿/***********************************************************************************************
 * 
 * ProjectName: WMSSoft.Lib.WinKStart
 * 
 * Description: Contains the configuration for Regions how Region Types
 * 
 * Created:     24.07.2015
 * 
 * Author:      matthias wagler - matthias@WMSSoft.de
 * 
 * Copyright:   Copyright 2015 by WMSSoft.net
 * 
 * License:     GPLv3
 * 
 * History:     24.07.2015 - matthias wagler matthias@WMSSoft.de   -   Created
 * 
 **********************************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WMSSoft.Lib.Basic;
using WMSSoft.Lib.WinKStart.Model.MenuConfig;

namespace WMSSoft.Lib.WinKStart.Classes.Metadata
{
    public static class Meta_Regions
    {
        public static List<KeyValueAssignment> GetRegionTypes()
        {
            try
            {
                List<KeyValueAssignment> tmpRegionTypes = new List<KeyValueAssignment>();
                tmpRegionTypes.Add(new KeyValueAssignment("", LanguageStrings.GetText("Please choose a Region - Type")));
                tmpRegionTypes.Add(new KeyValueAssignment("Simple", LanguageStrings.GetText("Simple List")));
                tmpRegionTypes.Add(new KeyValueAssignment("Groups", LanguageStrings.GetText("Groups")));

                return tmpRegionTypes;
            }
            catch (Exception Ex)
            {
                throw new Exception("Error while collecting Region-Types!", Ex);
            }
        }

        public static List<KeyValueAssignment> GetRegionAvailableExpandStates()
        {
            try
            {
                List<KeyValueAssignment> tmpExpandStates = new List<KeyValueAssignment>();
                tmpExpandStates.Add(new KeyValueAssignment("true", LanguageStrings.GetText("Collapse/ expand panels")));
                tmpExpandStates.Add(new KeyValueAssignment("false", LanguageStrings.GetText("panels always expanded")));
                return tmpExpandStates;
            }
            catch (Exception Ex)
            {
                throw new Exception("Error while collecting Expand States!");
            }
        }

        public static List<KeyValueAssignment> GetDefaultExpandStates()
        {
            try
            {
                List<KeyValueAssignment> tmpExpandStates = new List<KeyValueAssignment>();
                tmpExpandStates.Add(new KeyValueAssignment("Expanded", LanguageStrings.GetText("Panel is expanded")));
                tmpExpandStates.Add(new KeyValueAssignment("Collapsed", LanguageStrings.GetText("Panel ist collapsed")));
                return tmpExpandStates;
            }
            catch (Exception Ex)
            {
                throw new Exception("Error while collecting Default Expand States!");
            }
        }

        public static List<KeyValueAssignment> GetSortStates()
        {
            try
            {
                List<KeyValueAssignment> tmpExpandStates = new List<KeyValueAssignment>();
                tmpExpandStates.Add(new KeyValueAssignment("true", LanguageStrings.GetText("Sort Items")));
                tmpExpandStates.Add(new KeyValueAssignment("false", LanguageStrings.GetText("Do not sort Items")));
                return tmpExpandStates;
            }
            catch (Exception Ex)
            {
                throw new Exception("Error while collecting Default Expand States!");
            }
        }

        public static List<KeyValueAssignment> GetContextMenuStates()
        {
            try
            {
                List<KeyValueAssignment> tmpExpandStates = new List<KeyValueAssignment>();
                tmpExpandStates.Add(new KeyValueAssignment("false", LanguageStrings.GetText("Don't use a Context-Menu")));
                tmpExpandStates.Add(new KeyValueAssignment("true", LanguageStrings.GetText("Can define Context-Menu")));
                return tmpExpandStates;
            }
            catch (Exception Ex)
            {
                throw new Exception("Error while collecting Default Expand States!");
            }
        }

        public static List<KeyValueAssignment> GetNavigationStates()
        {
            try
            {
                List<KeyValueAssignment> tmpExpandStates = new List<KeyValueAssignment>();
                tmpExpandStates.Add(new KeyValueAssignment("false", LanguageStrings.GetText("Don't Navigate between folders")));
                tmpExpandStates.Add(new KeyValueAssignment("true", LanguageStrings.GetText("Navigate between folders")));
                return tmpExpandStates;
            }
            catch (Exception Ex)
            {
                throw new Exception("Error while collecting Default Expand States!");
            }
        }

        public static List<KeyValueAssignment> GetExpandStatesIfChangeOtherState()
        {
            try
            {
                List<KeyValueAssignment> tmpExpandStates = new List<KeyValueAssignment>();
                tmpExpandStates.Add(new KeyValueAssignment("false", LanguageStrings.GetText("Preserve current State")));
                tmpExpandStates.Add(new KeyValueAssignment("true", LanguageStrings.GetText("Collapse if other Panel Expands")));
                return tmpExpandStates;
            }
            catch (Exception Ex)
            {
                throw new Exception("Error while collecting Default Expand States!");
            }
        }

        public static List<KeyValueAssignment> GetDataSources()
        {
            try
            {
                List<KeyValueAssignment> tmpDataSources = new List<KeyValueAssignment>();

                tmpDataSources.Add(new KeyValueAssignment("", LanguageStrings.GetText("Use no DataSource")));

                List<Model.MenuConfig.DataSource> tmpDataSourceList = cMenuConfigReader.DataSources.DatasourceItems.Values.ToList();

                foreach (DataSource DSItem in tmpDataSourceList)
                {
                    tmpDataSources.Add(new KeyValueAssignment(DSItem.Name, LanguageStrings.GetText(DSItem.Name)));
                }

                return tmpDataSources;
            }
            catch (Exception Ex)
            {
                throw new Exception("Error while collecting Region-Types!", Ex);
            }
        }
    }
}
